package org.example.core.utils;

import org.example.core.model.entity.CustomResult;

/**
 * @author:hzc
 * @date:2024/7/8
 * @desc:
 */
public class ResultUtils {
    public static <T> CustomResult<T> success(T data) {
        return new CustomResult<T>(200,"success",data);
    }
    public static <T> CustomResult<T> success(Integer code,String message,T data) {
        return new CustomResult<T>(code,message,data);
    }
    public static <T> CustomResult<T> success(Integer code,String message) {
        return new CustomResult<T>(code,message,null);
    }
    public static <T> CustomResult<T> success() {
        return new CustomResult<T>(200,"success",null);
    }
    public static CustomResult fail(String message) {
        return new CustomResult(500,message);
    }
    public static CustomResult fail(Integer code,String message) {
        return new CustomResult(code,message);
    }
    public static <T> CustomResult<T> fail(Integer code,String message,T data) {
        return new CustomResult<T>(code,message,data);
    }
    public static CustomResult warn(String message) {
        return new CustomResult(601,message);
    }
    public static void main(String[] args) {
        System.out.println(ResultUtils.success("dfas"));
    }
}
